var vm = new Vue({ 
    el: '#container' 
    , data: { 
        buttons: {} 
        , query: { 
            page: 1 
            , pageSize: hcCore.pageSize 
            , eventId:'' 
            , message:'' 
        } 
        , tableData: { 
            records: [] 
            , total: 0 
        } 
        , detailsInfo: {
            visible: false,
            data: {}
        }
    } 
    , mounted: async function () { 
        const me = this; 
        me.buttons = await hcCore.getPowerButton(); 
        if (me.buttons.hasQuery) { 
            me.onQuery(); 
        } 
    } 
    , methods: {
        onQuery: function () { 
            let me = this; 
            hcCore.post({ 
                url: '/LogEvent/List' 
                , param: { 
                    page: me.query.page 
                    , page_size: me.query.pageSize 
                    , eventId: me.query.eventId 
                    , message: me.query.message 
                } 
                , success: function (rsp) { 
                    me.tableData.records = rsp.data; 
                    me.tableData.total = rsp.total; 
                } 
            }) 
        } 
        , onPageChange: function (page) { 
            this.query.page = page; 
            this.onQuery(); 
        } 
        , onDetails: function (row) {
            let me = this;
            me.detailsInfo.data = {};
            hcCore.post({
                url: '/LogEvent/Get/' + row.pkid
                , success: function (rsp) {
                    console.log(rsp.data);
                    me.detailsInfo.data = rsp.data;
                    me.detailsInfo.visible = true;
                }
            });
        }
        , onExport: function () {
            hcCore.handleExport('/LogEvent/Export?eventId=' + this.query.eventId + '&message=' + this.query.message);
        }
        , getParams: function () { 
            let param = {}; 
            this.edit.fields.forEach((item, index) => { 
                param[item.name] = item.value; 
            }); 
            return param; 
        }
        , recordIndex: function (index) { 
            return (this.query.page - 1) * this.query.pageSize + index + 1; 
        } 
    } 
});